import { Component, Injector, ViewChild, OnInit, ComponentFactoryResolver } from '@angular/core';
import { appModuleAnimation } from '@shared/animations/routerTransition';
import { AppComponentBase } from '@shared/common/app-component-base';
import { RoomTreeComponent } from './room-tree.component';
import { IBasicRoomInfo } from './basic-room-info';
import { RoomDetailComponent } from './room-detail.component';
import { ComponentRef } from '@angular/core/src/render3';
@Component({
    templateUrl: './room-index.component.html',
    animations: [appModuleAnimation()]
})
export class RoomIndexComponent extends AppComponentBase implements OnInit {
    @ViewChild('ouRoomDetail') ouRoomDetail: RoomDetailComponent;
    @ViewChild('ouRoomTree') ouRoomTree: RoomTreeComponent;

    compRef: ComponentRef<any>;
    basicRoomInfo: IBasicRoomInfo = null;
    roomshow = 1;
    locationhide = true;
    constructor(injector: Injector, private resolver: ComponentFactoryResolver) {
        super(injector);
    }

    ngOnInit() {}

    updatetreeinfo() {
        this.ouRoomTree.getTreeDataFromServer();
    }
    ouSelected(event: any): void {
        if (event.displayName == '全部') {
            this.locationhide = true;
        } else {
            this.locationhide = false;
            this.ouRoomDetail.roomId = event.id;
            this.ouRoomDetail.getRoomDetail(event.id);
            this.ouRoomDetail.getLocationData();
        }
    }
}
